package adapter.practice_01;


import org.apache.log4j.Logger;

/**
 * @author yi qiang
 * @date 2021/5/31 17:36
 */
public class AudioPlayer implements MediaPlayer{

    private final Logger log= Logger.getLogger(AudioPlayer.class);

    MediaAdapter adapter;

    @Override
    public void play(String audioType, String fileName) {
        if(audioType.equalsIgnoreCase("mp3")){
            log.info("Playing mp3.Name:"+fileName);
        }
        else if(audioType.equalsIgnoreCase("vlc")||
        audioType.equalsIgnoreCase("mp4")){
            adapter=new MediaAdapter(audioType);
            adapter.play(audioType,fileName);
        }
        else {
            log.info("Invalid type");
        }
    }
}
